<?php
	$page='1';
	if(isset($_GET[UP_RESULT_PAGE]))
	{
		$page=intval($_GET[UP_RESULT_PAGE]);
	}

    $sortby = 'contribution-desc';
	if( isset( $_GET['sortby'] ) )
	{
		$sortby = $_GET['sortby'];
	}
	
	
	//determine search type
	$isDesc = false;
	
	$pageVars['sortby'] = $sortby;
	//parse sort
	//price0 is sort by price asc and price1 is sortby price desc
	$sortbyArray = explode( "-", $sortby );
	if( count($sortbyArray) == 2 )
	{
		$sortby = $sortbyArray[0];
		$isDesc = $sortbyArray[1] == "asc"? false : true;
	}
	else 
	{
		$sortby = "";
	}	
	   
	/*
	 * Get top reviewer
	 */
	$result=array();
	$userDAO=GetUserDAO();
    if( edp_is_empty_string($sortby) )
    {
    	$result=$userDAO->GetTopReviewer( 'contribution', USER_INFO_PER_PAGE, $page, $isDesc );
    }
    else
    {
       	$result=$userDAO->GetTopReviewer( $sortby, USER_INFO_PER_PAGE, $page, $isDesc );
    }

	$totalCount = $userDAO->GetTopReviewerCount();	
	/*
	 * Page bar
	 */
	require_once ( LIB_DIR.'classes/Pager.php' );
	$pageObj = new Pager(edp_href_link(PAGENAME_TOP_REVIEWER, 'sortby='.$pageVars['sortby']),
	$totalCount, USER_INFO_PER_PAGE, $page, UP_RESULT_PAGE );
?>
